package com.project.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.project.bean.DrugBean;
import com.project.service.IDrugService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author RJ
 * @date 2022/9/16 10:18
 */
@RestController
@RequestMapping("drug")
public class DrugController {
    @Resource
    private IDrugService drugService;

    @RequestMapping("add")
    public String addDrug(DrugBean drugBean) {
        drugService.addDrug(drugBean);
        return "ok";
    }

    @RequestMapping("info")
    public IPage<DrugBean> cutDrugByItem(Integer pageNo, Integer pageSize, String drugName, String drugControlType, String drugType) {
        IPage<DrugBean> page = drugService.cutDrugByItem(pageNo, pageNo, drugName, drugControlType, drugType);
        return page;
    }
}
